package com.ithei.多线程第二天.生产者和消费者;

public class Protuct extends Thread {
    @Override
    public void run() {
        boo:while (true) {
            synchronized (Desk.lock) {
                if (Desk.count == 0) {
                    break boo;
                } else {
                    if (!Desk.flag) {
                        System.out.println("厨师在生产.........");
                        //Desk.count--;
                        Desk.flag=true;
                        Desk.lock.notifyAll();
                    }
                    try {
                        Desk.lock.wait();
                    } catch (InterruptedException e) {
                        //e.printStackTrace();
                    }

                }


            }
        }
    }
}
